#include <repository/member/points_policy_repository.h>

using namespace model;

// CRUD Operations
insert_ret_type
PointsPolicyRepository::create(const PointsPolicyDTO& points_policy_dto)
{
  return _insert(points_policy_dto);
};

select_ret_type<PointsPolicyDTO>
PointsPolicyRepository::get(const std::string& policy_name)
{
  return _select(db::points_policy{}.policy_name == policy_name);
};

update_ret_type PointsPolicyRepository::updateById(const in_id_type id,
                                                   const PointsPolicyDTO& dto)
{
  return _update(dto, db::points_policy{}.id == id);
};

delete_ret_type PointsPolicyRepository::removeById(const in_id_type id)
{
  return _remove(db::points_policy{}.id == id);
}

// Custom Queries
select_ret_type<PointsPolicyDTO> PointsPolicyRepository::getAll()
{
  return _select(db::points_policy{}.id >= 0);
}

select_ret_type<PointsPolicyDTO>
PointsPolicyRepository::getByPage(int page_size, int offset)
{
  return _select_from(db::points_policy{}.id >= 0, page_size, offset);
}

count_type PointsPolicyRepository::count()
{
  return _countById();
}

// 其他方法实现...
